export default class Modal {
  public toastMsg(message: string) {
    uni.showToast({
      icon: 'none',
      title: message
    })
  }
  public toastSuccessMsg(message: string) {
    uni.showToast({
      icon: 'success',
      title: message
    })
  }
  public toastErrorMsg(message: string) {
    uni.showToast({
      icon: 'error',
      title: message
    })
  }
  public async showLoading<T>(tisMessage: string, handle: () => T): Promise<T | null> {
    uni.showLoading({
      title: tisMessage,
      mask: true
    })
    try {
      return await handle()
    } catch (e) {
      return null
    } finally {
      uni.hideLoading()
    }
  }
}
